import { useImageDataStore } from "@renderer/store/pinia/imageData";
import { useSystemSettingStore } from "@renderer/store/pinia/systemSetting";



const resolveImg = () => {
  const imageDataStore = useImageDataStore()
  const handler = (data) =>{
    imageDataStore.updateImageData(data)
  }
  (window as any).api.onImageMsg(handler)
}

const onConnect = () => {
  const systemStore = useSystemSettingStore();
  (window as any).api.onConnect(() => {
    systemStore.updateConnectState(true)
    console.log("onConnect")
  });
}

const onDisconnect = () => {
  const systemStore = useSystemSettingStore();
  (window as any).api.onDisconnect(() => {
    systemStore.updateConnectState(false)
    console.log("onDisconnect")
  });
}

const onContextMenuSelectMsg = () =>{
  // (window as any).menuApi.onMenuAction((msg) => {
  //   const {type, data} = msg;
  //   console.log("onContentMenuMsg", type,data)
  // })
}


export {
  resolveImg,
  onConnect,
  onDisconnect,
  onContextMenuSelectMsg
}
